package com.demo.controller;

import com.demo.entity.Video;
import com.demo.mapper.VideoMapper;
import com.demo.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
public class VideoController {
    @Autowired
    private VideoService videoService;

    public List<Video> selectAllvideos() {
        return videoService.selectAllvideos();
    }

    public Video selectVideoById(int id) {
        return videoService.selectVideoById(id);
    }

    public String deleteVideoById(int id) {
        return videoService.deleteVideoById(id)?"删除成功":"删除失败";
    }

    public String insertVideo(Video video) {
        return videoService.insertVideo(video)?"添加成功":"添加失败";
    }

    public String updateVideo(Video video) {
        return videoService.updateVideo(video)?"修改成功":"修改失败";
    }
}
